fracsum := proc(A,B,s)
	local n, S1, S2,st;
	n := nops(A);
	
	if n=1 then
		return B[1]/(x - A[1]);
	fi;
	
	if type(s,even) = true then
		st:=s/2;
	else
		st := floor(s/2);
	fi;
	
	return normal(fracsum([seq(A[i], i=1..st)],[seq(B[i], i=1..st)],st) + fracsum([seq(A[i], i=((st+1)..s))],[seq(B[i], i=((st+1)..s))],st));
end;